import { request2 } from '@/utils/request'
import type { TrandeMarkResponseData, TradeMark } from './type'
enum API {
  TRADEMARK_URL = '/admin/product/baseTrademark/',
  ADDTRADEMARK_URL = '/admin/product/baseTrademark/save',
  UPDATETARDEMARK_URL = '/admin/product/baseTrademark/update',
  DELETE_RUL = '/admin/product/baseTrademark/remove/',
}
//获取以有品牌数据
export const reqHasTrademark = (page: number, limit: number) => {
  const url = API.TRADEMARK_URL + `${page}/${limit}`
  return request2.get<any, TrandeMarkResponseData>(url)
}
//新增和修改品牌的方法
export const reqAddOrUpdateTrademark = (data: TradeMark) => {
  if (data.id) {
    return request2.put<any, any>(API.UPDATETARDEMARK_URL, data)
  } else {
    return request2.post<any, any>(API.ADDTRADEMARK_URL, data)
  }
}
//删除
export const reqDeleteTrademark = (id: number) => {
  return request2.delete<any, any>(API.DELETE_RUL + id)
}
